<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="/公开课/JS/vue.min.js"></script>
    <style>
        .d2{
            margin: 0;
            width: 200px;
            height: 50px;
        }
        input{
            width: 200px;
        }
    </style>
</head>
<body>
    <div id="d2"><button class="d2" v-on:click="hide">登录</button><button class="d2" v-on:click="show">注册</button>
    <div id="d1"style="width: 400px;margin: 0px 0px;">
    <form action="" >
        <fieldset>
            <span>账号：</span><input type="text"><br>
            <span>密码：</span><input type="text"><br>
            <div v-if="flag"><span>邮箱：</span><input type="text"><br></div>
            <button>登录</button>
            <button>取消</button>
        </fieldset>
    </form>
</div>
</div>


<script>
    let vue = new Vue({
        el: "#d2",
        data:{ flag:true },
        methods:{
          show: function(){
            this.flag = true;
          },
          hide: function(){
            this.flag = false;
          }
        }
    })
</script>
</body>
</html>